'''
移除元素：[力扣题目链接](https://leetcode.cn/problems/remove-element/)
'''
from typing import List

class Solution:
    def removeElement(self, nums: List[int], val: int) -> int:
        L = len(nums)
        slow = 0
        fast = 0
        while fast < L:
            if nums[fast] != val:
                nums[slow] = nums[fast]
                slow +=1
            fast +=1
        return slow
# 测试
if __name__ == '__main__':
    nums = [3,2,2,3]
    val = 3
    s = Solution()
    print(s.removeElement(nums,val))